import request from 'UTIL/request'

/**
 * 客户列表
 * @param params
 */
export function GetList(params) {
  return request({
    url: 'crmCustomer/queryPageList',
    method: 'POST',
    data: params
  })
}

/**
 * 公海客户列表
 * @param params
 */
export function GetPoolList(params) {
  return request({
    url: 'crmCustomer/queryPoolPageList',
    method: 'POST',
    data: params
  })
}

/**
 * 客户详情
 * @param params
 */
export function QueryById(params) {
  return request({
    // url: 'crmCustomer/queryById',
    url: `crmCustomer/queryById/${params.customerId}`,
    method: 'POST',
    data: params,
		requestType: 'form'
  })
}

/**
 * 基本信息
 */
export function InformationById(params) {
  return request({
    url: `crmCustomer/information/${params.id}`,
    method: 'POST',
    data: params,
		requestType: 'form'
  })
}

/**
 * 新增/编辑时查询字段
 */
export function QueryFieldList(params) {
  const query = params && params.id ? `/${params.id}` : ''
  return request({
    url: `crmCustomer/field${query}`,
    method: 'POST',
    data: params,
		requestType: 'form'
  })
}

/**
 * 客户添加
 */
export function AddCustomer(params) {
  return request({
    url: 'crmCustomer/add',
    method: 'POST',
    data: params
  })
}

/**
 * 客户编辑
 */
export function UpdateCustomer(params) {
  return request({
    url: 'crmCustomer/update',
    method: 'POST',
    data: params
  })
}

/**
 * 客户删除
 * @param params
 */
export function DeleteByIds(params) {
  return request({
    url: 'crmCustomer/deleteByIds',
    method: 'POST',
    data: params
  })
}

/**
 * 客户设置成交状态
 * @param params
 */
export function SetDealStatus(params) {
  return request({
    url: 'crmCustomer/setDealStatus',
    method: 'POST',
    data: params,
		requestType: 'form'
  })
}

/**
 * 客户转移
 * @param params
 */
export function Transfer(params) {
  return request({
    url: 'crmCustomer/changeOwnerUser',
    method: 'POST',
    data: params
  })
}

/**
 * 客户放入公海
 * @param params
 */
export function UpdateCustomerByIds(params) {
  return request({
    url: 'crmCustomer/updateCustomerByIds',
    method: 'POST',
    data: params
  })
}

/**
 * 分配客户
 * @param params
 */
export function DistributeByIds(params) {
  return request({
    url: 'crmCustomer/distributeByIds',
    method: 'POST',
    data: params
  })
}

/**
 * 领取客户
 * @param params
 */
export function ReceiveByIds(params) {
  return request({
    url: 'crmCustomer/receiveByIds',
    method: 'POST',
    data: params
  })
}

/**
 * 客户锁定，解锁
 * @param params
 */
export function Lock(params) {
  return request({
    url: 'crmCustomer/lock',
    method: 'POST',
    data: params,
		requestType: 'form'
  })
}

/**
 * 客户跟进记录
 * @param params
 */
export function GetRecord(params) {
  return request({
    url: 'crmCustomer/getRecord',
    method: 'POST',
    data: params
  })
}

/**
 * 客户跟进记录添加
 * @param params
 */
export function AddRecord(params) {
  return request({
    url: 'crmCustomer/addRecord',
    method: 'POST',
    data: params
  })
}

/**
 * 客户相关联系人
 * @param params
 */
export function QueryContacts(params) {
  return request({
    url: 'crmCustomer/queryContacts',
    method: 'POST',
    data: params
  })
}

/**
 * 客户相关商机
 * @param params
 */
export function QueryBusiness(params) {
  return request({
    url: 'crmCustomer/queryBusiness',
    method: 'POST',
    data: params
  })
}

/**
 * 客户相关合同
 * @param params
 */
export function QueryContract(params) {
  return request({
    url: 'crmCustomer/queryContract',
    method: 'POST',
    data: params
  })
}

/**
 * 客户相关回款
 * @param params
 */
export function QueryReceivables(params) {
  return request({
    url: 'crmCustomer/queryReceivables',
    method: 'POST',
    data: params
  })
}

/**
 * 客户相关回款计划
 * @param params
 */
export function QueryReceivablesPlan(params) {
  return request({
    url: 'crmCustomer/queryReceivablesPlan',
    method: 'POST',
    data: params
  })
}

/**
 * 客户相关发票抬头
 * @param params
 */
export function QueryInvoiceInfo(params) {
  return request({
    url: 'crmCustomer/queryInvoiceInfo',
    method: 'POST',
    data: params
  })
}

/**
 * 客户相关团队
 * @param params
 */
export function GetMembers(params) {
  return request({
    url: `crmCustomer/getMembers/${params.id}`,
    method: 'POST',
		requestType: 'form'
  })
}

/**
 * 客户添加团队成员
 * @param params
 */
export function AddMembers(params) {
  return request({
    url: 'crmCustomer/addMembers',
    method: 'POST',
    data: params
  })
}

/**
 * 客户修改团队成员
 * @param params
 */
export function UpdateMembers(params) {
  return request({
    url: 'crmCustomer/updateMembers',
    method: 'POST',
    data: params
  })
}

/**
 * 客户删除团队成员
 * @param params
 */
export function DeleteMembers(params) {
  return request({
    url: 'crmCustomer/deleteMembers',
    method: 'POST',
    data: params
  })
}

/**
 * 附近的客户
 * @param params
 */
export function NearbyCustomer(params) {
  return request({
    url: 'crmCustomer/nearbyCustomer',
    method: 'POST',
    data: params,
		requestType: 'form'
  })
}

/**
 * 查询客户下附件列表
 * @param params
 */
export function QueryFileList(params) {
  return request({
    url: 'crmCustomer/queryFileList',
    method: 'POST',
    data: params,
		requestType: 'form'
  })
}
